home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / demostuf / mouse.pas < prev    next >
Pascal/Delphi Source File  |  1994-07-25  |  2KB  |  89 lines

  1. UNIT MOUSE;
  2. {
  3.   THIS PROGRAM WAS CODED BY BJARKE VIKS0E.
  4.   YOU ARE FREE TO DO WHATEVER YOU WANT WITH THIS PIECE OF CODE.
  5.   E-MAIL ME AT: dat92230@rix02.lyngbyes.dk IN 1994 FOR CHAT AND CODE.
  6. }
  7.  
  8. INTERFACE
  9.  
  10. function InitMouse : boolean;
  11. {Initialize mouse to its default values for current screenmode.
  12.  Mouse is turned off.}
  13. function MouseDriverPresent : boolean;
  14. {Returns TRUE if there were a mouse driver out there...}
  15. procedure MouseOn;
  16. {Turns mouse image on}
  17. procedure MouseOff;
  18. {Turns mouse image off}
  19. procedure MouseInfo(VAR x,y : integer; VAR lb,rb : boolean);
  20. {Get information about current x- and y-positions.
  21.  Also return info about current status of mouse buttons}
  22. procedure SetMousePos(x,y : integer);
  23. {Set mouse position...}
  24.  
  25.  
  26. IMPLEMENTATION
  27.  
  28. function InitMouse : boolean; assembler;
  29. asm
  30.     xor    ax,ax
  31.     int    $33
  32.     not    ax
  33.     xor    ax,1
  34.     and    ax,1
  35. end;
  36.  
  37. function MouseDriverPresent : boolean; assembler;
  38. asm
  39.     mov    ax,$0021
  40.     int    $33
  41.     mov    cx,FALSE
  42.     cmp    ax,-1
  43.     jne    @not
  44.     mov    cx,TRUE
  45. @not:
  46.     mov    ax,cx
  47. end;
  48.  
  49. procedure MouseOn; assembler;
  50. asm
  51.     mov    ax,$0001
  52.     int    $33
  53. end;
  54.  
  55. procedure MouseOff; assembler;
  56. asm
  57.     mov    ax,$0002
  58.     int    $33
  59. end;
  60.  
  61. procedure MouseInfo(VAR x,y : integer; VAR lb,rb : boolean); assembler;
  62. asm
  63.     mov    ax,$0003
  64.     int    $33
  65.     les    si,x
  66.     mov    [es:si],cx
  67.     les    si,y
  68.     mov    [es:si],dx
  69.  
  70.     mov    ax,bx
  71.     and    al,1
  72.     les    si,lb
  73.     mov    [es:si],al
  74.     shr    bl,1
  75.     and    bl,1
  76.     les    si,rb
  77.     mov    [es:si],bl
  78. end;
  79.  
  80. procedure SetMousePos(x,y : integer); assembler;
  81. asm
  82.     mov    ax,$0004
  83.     mov    cx,x
  84.     mov    dx,y
  85.     int    $33
  86. end;
  87.  
  88. end.
  89.